#include <bits/stdc++.h>
using namespace std;

int main() {
	int num1[7] = {0}, num2[7] = {0};
	int data, time = 0;
	for (int i = 0; i < 7; ++i) {
		cin >> num1[i] >> num2[i];
	}
	for (int i = 0; i < 7; ++i) {
		if (num1[i] + num2[i] > time) {
			time = num1[i] + num2[i];
			data = i + 1;
		}
	}
	if (time > 8) {
		cout << data;
	} else
		cout << 0;
	return 0;
}